﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net;

namespace LeadTeam.Exam.AdminTool
{
    public partial class MainForm : Form,IMainFormView
    {
        private MainFormController _controller;

        public MainFormController Controller
        {
            get { return _controller; }
            set
            {
                this._controller = value;

            }
        }

        public MainForm()
        {
            InitializeComponent();
        }

        private void MainForm_Load(object sender, EventArgs e)
        {
            OrganizationsControllor organControllor = new OrganizationsControllor(new OrganizationsView());
            organControllor.view.Dock = DockStyle.Fill;
            this.panelLeft.Controls.Add(organControllor.view);

           
            OrganizationsManagePanelController organManageController = new OrganizationsManagePanelController
                (new OrganizationsManagePanel("组织管理", organControllor.view,this),this);

            organManageController.view.Dock = DockStyle.Fill;
            this.panelRight.Controls.Add(organManageController.view);
        }

        private int stime=0;
        private int etime = 0;
        public void SetRequesting()
        {
            tssDesc.Text = "请求中...";
            tssProgress.Value = 3;
            tssTime.Text = "";
            stime = System.Environment.TickCount;
        }

        public void SetDone()
        {
            etime = System.Environment.TickCount;

            float second = (Convert.ToSingle(etime - stime) / 1000f);

            tssDesc.Text = "完成 ";
            tssTime.Text = "用时:" + second.ToString() + " (s)";
            tssProgress.Value = 10;
            stime = 0;
            etime = 0;
        }

        public void SetReady()
        {
            tssDesc.Text = "就绪";
            tssProgress.Value = 0;
            tssTime.Text = "";
        }
    }
}
